#! /usr/bin/env python3
# -*- coding:utf8 -*-
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
# data source: https://ourworldindata.org/nuclear-energy
years_electricity = [ [1965, 25.5], [1966, 34.4], [1967, 41.0], [1968, 52.1],
[1969, 61.8], [1970, 78.9], [1971, 109.7], [1972, 152.2], [1973, 203.9],
[1974, 266.6], [1975, 369.8], [1976, 432.7], [1977, 538.5], [1978, 625.8],
[1979, 650.9], [1980, 711.9], [1981, 840.8], [1982, 912.2], [1983, 1033.8],
[1984, 1254.6], [1985, 1488.9], [1986, 1594.7], [1987, 1734.7], [1988, 1891.2],
[1989, 1945.0], [1990, 2000.5], [1991, 2096.2], [1992, 2112.1], [1993, 2184.8],
[1994, 2225.8], [1995, 2322.4], [1996, 2406.8], [1997, 2390.3], [1998, 2431.4],
[1999, 2524.4], [2000, 2505.9], [2001, 2572.3], [2002, 2600.4], [2003, 2576.2],
[2004, 2681.2], [2005, 2685.4], [2006, 2719.9], [2007, 2665.3], [2008, 2654.5],
[2009, 2617.3], [2010, 2686.6], [2011, 2576.2], [2012, 2403.2], [2013, 2419.4],
[2014, 2468.3], [2015, 2501.5], [2016, 2533.1], [2017, 2548.2], [2018, 2620.1],
[2019, 2723.8], [2020, 2635.8], [2021, 2735.5] ]
# please update in future.
years, electricity = map(list, zip(*years_electricity))
plt.rc('font', size=14)
fig = plt.figure(figsize=(600 / 90.0, 400 / 90.0), dpi=72)
plt.bar(years, electricity, edgecolor='black', width=0.6)
plt.gca().xaxis.set_major_locator(ticker.MultipleLocator(10))
plt.ylim(0)
plt.xlabel('Jahr')
plt.ylabel('Energie in TWh')
plt.title('Stromerzeugung in Kernkraftwerken %s\u2013%s' % (min(years), max(years)))
plt.grid(True)
plt.tight_layout()
plt.savefig('Stromerzeugung in Kernkraftwerken ab 1965.svg')